//地图容器
//var chart = echarts.init(document.getElementById('mainmap'));
var dom = document.getElementById("data2");
var myChart = echarts.init(dom);
var app = {};
app.title = '坐标轴刻度与标签对齐';

var dom2 = document.getElementById("data1");
var myChart2 = echarts.init(dom2);
var app2 = {};

var dom3 = document.getElementById("data3");
var myChart3 = echarts.init(dom3);
var app3 = {};

var dom4 = document.getElementById("data4");
var myChart4 = echarts.init(dom4);
var app4 = {};

option = {
    title: {
        text: '2018年度工资发放趋势统计',
        subtext: '',
        x: 'center',
        color: "#212529",
        textStyle: {
            color: "#212529",
            fontSize: 24
        }
    },
    color: ['#ff9b00'],
    tooltip: {
        trigger: 'axis',
        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
            type: 'line'        // 默认为直线，可选为：'line' | 'shadow'
        },
        color: "#212529",
        textStyle: {
            color: "#212529"
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true,
        textStyle: {
            color: "#212529"
        },
        color: "#212529"
    },
    xAxis: [
        {
            type: 'category',
            data: [
                '2018年8月',
                '2018年9月',
                '2018年10月',
                '2018年11月',
                '2018年12月',
            ],
            axisTick: {
                alignWithLabel: true
            },
            axisLabel: {
                interval: 0,//横轴信息全部显示
                rotate: 0,//-30度角倾斜显示
            },
            axisLine: {
                lineStyle: {
                    color: '#212529',
                    width: 1,//这里是为了突出显示加上的
                }
            }
        }
    ],
    yAxis: [
        {
            type: 'value',
            axisLine: {
                lineStyle: {
                    color: '#212529',
                    width: 1,//这里是为了突出显示加上的
                }
            }
        }
    ],
    series: [
        {
            name: '增长数量',
            type: 'bar',
            barWidth: '60%',
            data: [5, 10, 0, 0,0]
        }
    ]
};


function showTime() {
    var nowtime = new Date();
    var year = nowtime.getFullYear();
    var month = nowtime.getMonth() + 1;
    var date = nowtime.getDate();
    var hh = nowtime.getHours();
    var mm = nowtime.getMinutes();
    var ss = nowtime.getSeconds();

    if (hh < 10) {
        hh = "0" + hh;
    }
    if (ss < 10) {
        ss = "0" + ss;
    }
    if (mm < 10) {
        mm = "0" + mm;
    }
    if (document.getElementById("date")){
        document.getElementById("date").innerText = year + "年" + month + "月" + date + "日  ";
        document.getElementById("date2").innerText = hh + ":" + mm + ":" + ss + "  ";
    }else {
        clearInterval(iCount);
    }

}
var iCount = setInterval("showTime()", 1000);


option2 = {
    title: {
        text: '工资提现/留存比例',
        subtext: '',
        x: 'center',
        color: "#212529",
        textStyle: {
            color: "#212529",
            fontSize: 24
        }
    },
    tooltip: {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    legend: {
        show: false,
        orient: 'vertical',
        left: 'left',
        data: ['8月','9月']
    },
    lineStyle: {
        color: "#FFF"
    },
    series: [
        {
            name: '提现比例',
            type: 'pie',
            label: {
                normal: {
                    formatter: '{b}:{c} ({d}%)',
                    textStyle: {
                        fontWeight: 'bold',
                        fontSize: 15
                    }
                }
            },
            radius: '55%',
            center: ['50%', '60%'],
            data: [
                {value: 30, name: '提现'},
                {value: 70, name: '留存'},
            ],
            itemStyle: {
                emphasis: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.9)'
                }
            },
            color: ['#c23531', '#007BFF', '#d48265', '#19c30f', '#ca8622', '#6e7074', '#546570', '#c4ccd3']
        }
    ]
};

/*
option3 = {
    title: {
        text: '工资金额比例分布',
        subtext: '',
        x: 'center',
        color: "#fff",
        textStyle: {
            color: "#fff",
            fontSize: 24
        }
    },
    tooltip: {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },

    lineStyle: {
        color: "#FFF"
    },
    series: [
        {
            name: '工资金额比例分布',
            type: 'pie',
            label: {
                normal: {
                    formatter: '{b}:{c} ({d}%)',
                    textStyle: {
                        fontWeight: 'bold',
                        fontSize: 15
                    }
                }
            },
            radius: '55%',
            center: ['50%', '60%'],
            data: [
                {value: 0, name: '3000以下'},
                {value: 0, name: '3000~4500'},
                {value: 0, name: '4500~6000'},
                {value: 0, name: '6000~10000'},
                {value: 0, name: '10000~12000'},
                {value: 0, name: '12000以上'}
            ],
            itemStyle: {
                emphasis: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.9)'
                }
            },
            color: ['#d48265', '#19c30f', '#ca8622', '#6e7074', '#c4ccd3', '#c23531', '#c4ccd3']
        }
    ]
};

var option4 = {
    title: {
        text: '2018年度工资增长趋势',
        subtext: '',
        x: 'center',
        color: "#fff",
        textStyle: {
            color: "#fff",
            fontSize: 24
        }
    },
    xAxis: {
        type: 'category',
        data: [
            ' 2018年9月', ' 2018年10月', ' 2018年11月', ' 2018年12月',
        ],
        axisTick: {
            alignWithLabel: true
        },
        axisLabel: {
            interval: 4,//横轴信息全部显示
            rotate: 0,//-30度角倾斜显示
        },
        axisLine: {
            lineStyle: {
                color: '#fff',
                width: 1,//这里是为了突出显示加上的
            }
        }
    },

    yAxis: {
        type: 'value',
        axisLine: {
            lineStyle: {
                color: '#fff',
                width: 1,//这里是为了突出显示加上的
            }
        }
    },
    series: [
        {
            name: '创业青年年龄分布',
            label: {
                normal: {
                    formatter: '{b}:{c} ({d}%)',
                    textStyle: {
                        fontWeight: 'bold',
                        fontSize: 15
                    }
                }
            },
            data: [0, 0, 0, 0],
            type: 'line',

            color: ['#19c30f', '#ca8622', '#6e7074', '#546570', '#c4ccd3']
        }]
};
*/


myChart.setOption(option, true);
myChart2.setOption(option2, true);
/*myChart3.setOption(option3, true);
myChart4.setOption(option4, true);*/


var analyse = new Vue({
    el:"#content-header",
    data:{
        totalCount:0,
        totalMoney:0,
        monthTXMoney:0,
        monthLCMoney:0,
        monthLCNoMoney:0,
    }
});

var url = encodeURI("./analysisTotal.action");
$.ajax({
    type: 'POST',
    url: url,
    data: {},
    dataType: "json",
    success: function (result) {
        if (result.success) {
            //刷新表格
            analyse.totalCount = result.totalCount;
            analyse.totalMoney = result.totalMoney;
            analyse.monthTXMoney = result.monthTXMoney;
            analyse.monthLCMoney = result.monthLCMoney;
            analyse.monthLCNoMoney = result.monthLCNoMoney;
        } else {

        }
    },
    dataType: "json"
});








